/**
 * Created by shanyun.gu on 2017/3/20.
 */
define(['router', 'angularAMD', 'ngLoader', 'ui-route'], function (router, angularAMD, ngLoader) {
    // console.log(1);
    var app = angular.module("ngApp", ['ui.router']);
    app.config(function ($stateProvider, $urlRouterProvider) {
        // console.log(router);
        if (router.routes) {
            angular.forEach(router.routes, function (route, path) {
                $stateProvider.state(path, {
                    templateUrl: route.templateUrl,
                    url: route.url,
                   // cache:false,
                    resolve: ngLoader(route.dependencies),
                    allowAnonymous: route.allowAnonymous
                })
            })
            if (router.defaultRoute)
                $urlRouterProvider.when("", router.defaultRoute);
        }
    })
    return angularAMD.bootstrap(app);
});